﻿using System;
using Brjnk.Common;
using Brjnk.GpxExplorer.Data.GPX.SerializationClasses;

namespace Brjnk.GpxExplorer.Data.GPX
{
    public class GpxGeocacheLog : GeocacheLog, IGpxObject
    {
        private cacheLog data;

        public GpxGeocacheLog()
            : this(new cacheLog())
        { }

        public GpxGeocacheLog(cacheLog data)
        {
            this.data = data;
        }

        public object GetUnderlayingObject()
        {
            return data;
        }

        public override DateTime Date
        {
            get
            {
                return data.date;
            }
            set
            {
                data.date = value;
                data.dateSpecified = true;
                OnPropertyChanged("Date");
            }
        }

        public override string Type
        {
            get
            {
                return data.type;
            }
            set
            {
                data.type = value;
                OnPropertyChanged("Type");
            }
        }

        public override string Finder
        {
            get
            {
                return data.finder.Value;
            }
            set
            {
                data.finder.Value = value;
                OnPropertyChanged("Finder");
            }
        }

        public override string Text
        {
            get
            {
                return data.text.Value;
            }
            set
            {
                data.text.Value = value;
                OnPropertyChanged("Text");
            }
        }

        public override object Clone()
        {
            return new GpxGeocacheLog((cacheLog)DeepClone.Clone(this.GetUnderlayingObject()));
        }
    }
}